
#ifndef _AUTO_LOCK_IMPL
#define _AUTO_LOCK_IMPL

namespace nebula { namespace utility {

class auto_lock_impl_base
{
public:
    virtual ~auto_lock_impl_base() {};

    virtual void lock() = 0;

    virtual void unlock() = 0;
};

template<typename lock_type>
class auto_lock_impl : public auto_lock_impl_base
{
private:
    lock_type* lock_ref;

public:

    template<typename lock_type_>
    explicit auto_lock_impl(lock_type_* rhs) : lock_ref(rhs) {
    };

    virtual void lock()
    {
        lock_ref->lock();
    };

    virtual void unlock()
    {
        lock_ref->unlock();
    };
};

}} // namespace nebula::utility

#endif

